package com.kuang;

import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * ClassName: TestPool
 * Description:
 * Date: 2021/3/16 21:44
 * Company: TravelSky
 *
 * @author YangXin
 */
public class TestPool {

    public static void main(String[] args) {
        //创建服务,线程池
        ExecutorService service = Executors.newFixedThreadPool(10);
        service.execute(new MyPool());
        service.execute(new MyPool());
        service.execute(new MyPool());
        service.execute(new MyPool());
        //关闭
        service.shutdown();

    }
}
class  MyPool implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 1; i++) {
            System.out.println(Thread.currentThread().getName());
        }
    }
}

